<template>
<tr>
  <td>{{name}}</td>
  <td>{{nickname}}</td>
  <td>{{mobile}}</td>
  <td>{{realName}}</td>
  <td>{{sexText}}</td>
  <td>{{curTimeText}}</td>
  <td>{{addTimeText}}</td>
  <td>
    <a :href="`#/admin-role-${platType}-${adminId}`" class="badge badge-info" title="权限">
      <span class="far fa-user"> 角色</span>
    </a>
    &nbsp;
    <a href="javascript:void(0);" class="badge badge-info" title="编辑" v-on:click="$emit('edit',index)">
      <span class="far fa-edit"> 编辑</span>
    </a>
    &nbsp;
    <a href="javascript:void(0);" class="badge badge-info" title="删除" v-on:click="$emit('del',index)">
      <span class="far fa-trash-alt"> 删除</span>
    </a>
    &nbsp;
  </td>
</tr>
</template>
<script>
  import { sexs } from '../dist/js/enum'

  export default {
    name: 'AdminListItem',
    props: {
      platType: String,
      index: Number,
      adminId: Number,
      name: String,
      nickname: String,
      mobile: String,
      realName: String,
      sex: Number,
      curTime: Number,
      addTime: Number
    },
    data() {
      return {}
    },
    computed: {
      sexText() {
        if (this.sex == undefined || this.sex == null) {
          return '未知'
        }
        return sexs[this.sex].text
      },
      curTimeText() {
        let date = new Date()
        date.setTime(this.curTime)
        return date.format('yyyy-MM-dd hh:mm:ss')
      },
      addTimeText() {
        let date = new Date()
        date.setTime(this.addTime)
        return date.format('yyyy-MM-dd hh:mm:ss')
      }
    }
  }
</script>